package com.jlect.swebing.ui.client;

/**
 * Provides focus manager for the UI library.
 *
 * @author Sergey Kozmin
 * @since 24.11.2007 18:19:11
 */
public class FocusManagerProvider {
    private static FocusManager focusManager = null;

    public static FocusManager getFocusManager() {
        /*if (focusManager == null) {
            throw new IllegalStateException("Initialize focus manager first. ");
        }*/
        return focusManager;
    }

    public static void setFocusManager(FocusManager focusManager) {
        if(FocusManagerProvider.focusManager != null) {
            FocusManagerProvider.focusManager.deInitialize();
        }
        if(focusManager != null) {
            focusManager.initialize();
        }
        FocusManagerProvider.focusManager = focusManager;
    }
}
